﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using FlightSystemControlLayer;
using Classes;

namespace FlightSystemWCF
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class FlightService : IFlightService
    {
        // private IFlightService flightServiceObj = new FlightService();
        private SearcherCtr searcherControl = new SearcherCtr();
        private BookingCtr bookingCotrol = new BookingCtr();


        public Connection getCheapest(City from, City to, int noOfSeats, DateTime departure, DateTime departureEndTime)
        {

            return searcherControl.DijkstraCtr(from, to, noOfSeats, departure, departureEndTime);
        }
        public Connection getFastest(City from, City to, int noOfSeats, DateTime departure, DateTime departureEndTime)
        {

            return searcherControl.DijkstraTimeCtr(from, to, noOfSeats, departure, departureEndTime);
        }

        public IList<City> GetCityList()
        {
            IList<City> cities = searcherControl.getCityList();
            return cities;
        }
        public ListOfConnections getListOfConnections(City from, City to, int noOfSeats, DateTime departure, DateTime departureEndTime)
        {

            return searcherControl.MakeASearch(from, to, noOfSeats, departure, departureEndTime);
        }
        public bool Book(Connection conn, int seatsWanted, string fname, string lname, string address, string country, string phone, string email, string passport)
    {
        
            return bookingCotrol.Book(conn, seatsWanted, fname, lname, address, country, phone, email, passport);
    }
    }
}
